window.onload = function (){
    document.getElementById("username").innerText = $.cookie("username")
}

function DownloadFile() {
    var radioes = document.getElementsByName("filename");
    if (radioes.length === 0) {
        alert("文件列表为空");
        return;
    }
    for (let i = 0; i < radioes.length; i++) {
        if (radioes[i].checked) {
            let downloadaction = document.getElementById("downloadaction");
            downloadaction.action=downloadaction.action+"?"+radioes[i].value;
            break;
        }
        if (i === radioes.length - 1) {
            alert("还未选择要下载的文件");
            return;
        }
    }
    document.getElementById("downloadFile").click();
}

function DeleteFile() {
    var radioes = document.getElementsByName("filename");
    if (radioes.length === 0) {
        alert("文件列表为空");
        return;
    }
    for (let i = 0; i < radioes.length; i++) {
        if (radioes[i].checked) {
            document.getElementById("deleteFile").value = radioes[i].value;
            break;
        }
        if (i === radioes.length - 1) {
            alert("还未选择要删除的文件");
            return;
        }
    }
    document.getElementById("deleteFile").click();
}